import time

from pywinauto import Application

app = Application(backend="uia").connect(process=31592)
win = app.window(title_re=".*Sublime Text.*")
# win.wait("visible")
# # 对窗口进行操作
# time.sleep(3)
# #关闭窗口
# win.maximize()
# print("maximize:",win.maximize())
# time.sleep(3)
# win.print_control_identifiers()
# win.minimize()
# print("minimize:",win.minimize())
# time.sleep(3)
#窗口还原
# win.restore()
#
# pro = win.应用程序
# pro1 = win.Menu2
# proc = win["应用服务"]

#方法二: child_window定位
win.child_window(title="应用程序")
win.close()